home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / cli / UnixUtils.lha / UnixUtils / Source / Diff / Amiga.Patches next >
Encoding:
Text File  |  1992-04-14  |  10.8 KB  |  419 lines

  1. Files /GNU/regex.h and regex.h are identical
  2. Files /GNU/limits.h and limits.h are identical
  3. Files /GNU/getopt.h and getopt.h are identical
  4. *** /GNU/diff.h    Fri Apr 13 07:08:00 1984
  5. --- diff.h    Fri Apr 13 07:33:00 1984
  6. ***************
  7. *** 22,27 ****
  8. --- 22,42 ----
  9.   #include <stdio.h>
  10.   #include <sys/types.h>
  11.   #include <sys/stat.h>
  12. + #include "regex.h"
  13. + #ifdef AMIGA
  14. + #include <time.h>
  15. + #include <sys/dir.h>
  16. + #include <fcntl.h>
  17. + #define HAVE_NDIR
  18. + #define bcopy(s,d,n)    memcpy((d),(s),(n))
  19. + #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  20. + #define bzero(s,n)    memset((s),0,(n))
  21. + #define index    strchr
  22. + #define rindex    strrchr
  23. + #endif
  24.   
  25.   #ifdef USG
  26.   #include <time.h>
  27. ***************
  28. *** 39,48 ****
  29. --- 54,65 ----
  30.   #define direct dirent
  31.   #endif
  32.   #else /* not USG */
  33. + #ifndef AMIGA
  34.   #include <sys/time.h>
  35.   #include <sys/dir.h>
  36.   #include <sys/file.h>
  37.   #endif
  38. + #endif
  39.   
  40.   #ifdef USG
  41.   /* Define needed BSD functions in terms of sysV library.  */
  42. ***************
  43. *** 74,81 ****
  44. --- 91,100 ----
  45.   #define    FALSE        (0)
  46.   #define TRUE        1
  47.   
  48. + #ifndef AMIGA
  49.   #define min(a,b) ((a) <= (b) ? (a) : (b))
  50.   #define max(a,b) ((a) >= (b) ? (a) : (b))
  51. + #endif
  52.   
  53.   #ifndef PR_FILE_NAME
  54.   #define PR_FILE_NAME "/bin/pr"
  55. ***************
  56. *** 318,324 ****
  57.   
  58.   /* Describe the two files currently being compared.  */
  59.   
  60. ! struct file_data files[2];
  61.   
  62.   /* Queue up one-line messages to be printed at the end,
  63.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  64. --- 337,343 ----
  65.   
  66.   /* Describe the two files currently being compared.  */
  67.   
  68. ! EXTERN struct file_data files[2];
  69.   
  70.   /* Queue up one-line messages to be printed at the end,
  71.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  72. ***************
  73. *** 352,358 ****
  74. --- 371,381 ----
  75.   #endif
  76.   VOID *xmalloc ();
  77.   VOID *xrealloc ();
  78. + #ifdef __STDC__
  79. + char *concat (char *, char *, char *);
  80. + #else
  81.   char *concat ();
  82. + #endif
  83.   void free ();
  84.   char *rindex ();
  85.   char *index ();
  86. *** /GNU/version.c    Thu Jan 06 16:31:00 1983
  87. --- version.c    Fri Apr 13 07:31:00 1984
  88. ***************
  89. *** 1,3 ****
  90.   /* Version number of GNU diff.  */
  91.   
  92. ! char *version_string = "1.15";
  93. --- 1,3 ----
  94.   /* Version number of GNU diff.  */
  95.   
  96. ! char *version_string = "1.15 - Amiga release 920413";
  97. *** /GNU/util.c    Fri Apr 13 07:09:00 1984
  98. --- util.c    Fri Apr 13 07:30:00 1984
  99. ***************
  100. *** 129,136 ****
  101.     strcat (name, " ");
  102.     strcat (name, name1);
  103.   
  104. !   if (paginate_flag)
  105. !     {
  106.         int pipes[2];
  107.         int desc;
  108.   
  109. --- 129,136 ----
  110.     strcat (name, " ");
  111.     strcat (name, name1);
  112.   
  113. !   if (paginate_flag) {
  114. ! #ifndef AMIGA
  115.         int pipes[2];
  116.         int desc;
  117.   
  118. ***************
  119. *** 162,167 ****
  120. --- 162,172 ----
  121.         close (pipes[0]);
  122.         outfile = fdopen (pipes[1], "w");
  123.       }
  124. + #else
  125. +     print_message_queue();
  126. +     fprintf(stderr,"This option is unavailable on Amiga\n");
  127. +     exit(2);
  128. + #endif /* not AMIGA */
  129.     }
  130.     else
  131.       {
  132. ***************
  133. *** 188,194 ****
  134. --- 193,201 ----
  135.     if (outfile != stdout)
  136.       {
  137.         fclose (outfile);
  138. + #ifndef AMIGA
  139.         wait (0);
  140. + #endif
  141.       }
  142.   }
  143.   
  144. Files /GNU/regex.c and regex.c are identical
  145. Files /GNU/normal.c and normal.c are identical
  146. Files /GNU/io.c and io.c are identical
  147. Files /GNU/ifdef.c and ifdef.c are identical
  148. Files /GNU/getopt1.c and getopt1.c are identical
  149. Files /GNU/getopt.c and getopt.c are identical
  150. Files /GNU/ed.c and ed.c are identical
  151. *** /GNU/dir.c    Fri Apr 13 07:08:00 1984
  152. --- dir.c    Mon Apr 09 08:33:00 1984
  153. ***************
  154. *** 17,22 ****
  155. --- 17,28 ----
  156.   along with GNU DIFF; see the file COPYING.  If not, write to
  157.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  158.   
  159. + #include <exec/types.h>
  160. + #include <exec/memory.h>
  161. + #include <libraries/dos.h>
  162. + #include <proto/dos.h>
  163. + #include <proto/exec.h>
  164. + #include "regex.h"
  165.   #include "diff.h"
  166.   
  167.   static int compare_names ();
  168. ***************
  169. *** 36,43 ****
  170.        char *dirname;
  171.        int nonex;
  172.   {
  173. !   register DIR *reading;
  174. !   register struct direct *next;
  175.     struct dirdata dirdata;
  176.   
  177.     /* Address of block containing the files that are described.  */
  178. --- 42,49 ----
  179.        char *dirname;
  180.        int nonex;
  181.   {
  182. !   BPTR dlock;
  183. !   struct FileInfoBlock *pFIB;
  184.     struct dirdata dirdata;
  185.   
  186.     /* Address of block containing the files that are described.  */
  187. ***************
  188. *** 57,64 ****
  189.       }
  190.   
  191.     /* Open the directory and check for errors.  */
  192. !   reading = opendir (dirname);
  193. !   if (!reading)
  194.       {
  195.         perror_with_name (dirname);
  196.         dirdata.length = -1;
  197. --- 63,70 ----
  198.       }
  199.   
  200.     /* Open the directory and check for errors.  */
  201. !   dlock = Lock(dirname, ACCESS_READ);
  202. !   if (!dlock)
  203.       {
  204.         perror_with_name (dirname);
  205.         dirdata.length = -1;
  206. ***************
  207. *** 65,70 ****
  208. --- 71,84 ----
  209.         return dirdata;
  210.       }
  211.   
  212. +   pFIB = (struct FileInfoBlock *) AllocMem(sizeof(struct FileInfoBlock),
  213. +           MEMF_CLEAR);
  214. +   if (!pFIB) {
  215. +     UnLock(dlock);
  216. +     dirdata.length = -1;
  217. +     return dirdata;
  218. +   }
  219.     /* Initialize the table of filenames.  */
  220.   
  221.     nfiles = 100;
  222. ***************
  223. *** 74,98 ****
  224.     /* Read the directory entries, and insert the subfiles
  225.        into the `files' table.  */
  226.   
  227. !   while (next = readdir (reading))
  228. !     {
  229. !       /* Ignore the files `.' and `..' */
  230. !       if (next->d_name[0] == '.'
  231. !       && (next->d_name[1] == 0
  232. !           || (next->d_name[1] == '.'
  233. !           && next->d_name[2] == 0)))
  234.       continue;
  235. !       if (files_index == nfiles)
  236. !     {
  237.         nfiles *= 2;
  238. !       files
  239. !         = (char **) xrealloc (files, sizeof (char *) * nfiles);
  240.       }
  241. !       files[files_index++] = concat (next->d_name, "", "");
  242.       }
  243.   
  244. !   closedir (reading);
  245.   
  246.     /* Sort the table.  */
  247.     qsort (files, files_index, sizeof (char *), compare_names);
  248. --- 88,108 ----
  249.     /* Read the directory entries, and insert the subfiles
  250.        into the `files' table.  */
  251.   
  252. !   if (Examine(dlock, pFIB)) {
  253. !     while (ExNext(dlock, pFIB)) {
  254. !       if (pFIB->fib_FileName[0] == '.' && pFIB->fib_FileName[1] == '\0' ||
  255. !           pFIB->fib_FileName[1] == '.' && pFIB->fib_FileName[2] == '\0')
  256.             continue;
  257. !       if (files_index == nfiles) {
  258.             nfiles *= 2;
  259. !               files = (char **) xrealloc (files, sizeof (char *) * nfiles);
  260.             }
  261. !       files[files_index++] = concat(pFIB->fib_FileName, "", "");
  262. !     }
  263.     }
  264.   
  265. !   FreeMem(pFIB, sizeof(struct FileInfoBlock));
  266. !   UnLock(dlock);
  267.   
  268.     /* Sort the table.  */
  269.     qsort (files, files_index, sizeof (char *), compare_names);
  270. Files /GNU/diff3.c and diff3.c are identical
  271. *** /GNU/diff.c    Fri Apr 13 07:08:00 1984
  272. --- diff.c    Fri Apr 13 07:49:00 1984
  273. ***************
  274. *** 24,29 ****
  275. --- 24,36 ----
  276.   #include "regex.h"
  277.   #include "diff.h"
  278.   #include "getopt.h"
  279. + #ifdef AMIGA
  280. + char *fixupname(char *);
  281. + /* Patch for the Amiga: 0's in stats are OK for stdin */
  282. + int fstat(int fd, struct stat *ps);
  283. + int fstat(int fd, struct stat *ps) { return 0; }
  284. + #endif
  285.   
  286.   
  287.   /* Nonzero for -r: if comparing two directories,
  288. ***************
  289. *** 446,451 ****
  290. --- 453,461 ----
  291.     int val;
  292.     int errorcount = 0;
  293.     int stat_result[2];
  294. + #ifdef AMIGA
  295. +   char *tmp_name;
  296. + #endif
  297.   
  298.     /* If this is directory comparison, perhaps we have a file
  299.        that exists only in one of the directories.
  300. ***************
  301. *** 473,480 ****
  302.     if (name1 == 0)
  303.       name1 = name0;
  304.   
  305. !   inf[0].name = dir0 == 0 ? name0 : concat (dir0, "/", name0);
  306. !   inf[1].name = dir1 == 0 ? name1 : concat (dir1, "/", name1);
  307.   
  308.     /* Stat the files.  Record whether they are directories.
  309.        Record in stat_result whether stat fails.  */
  310. --- 483,517 ----
  311.     if (name1 == 0)
  312.       name1 = name0;
  313.   
  314. ! #ifdef AMIGA
  315. !   if (dir0 == 0L) inf[0].name = name0;
  316. !   else {
  317. !     if (*dir0 == '\0') inf[0].name = strdup(name0);
  318. !     else {
  319. !       tmp_name = concat(dir0, "/", name0);
  320. !       inf[0].name = fixupname(tmp_name);
  321. !       free(tmp_name);
  322. !     };
  323. !   };
  324. !   /* fprintf(stderr,"494: fixupname=%s\n",inf[0].name); */
  325. ! #else
  326. !   inf[0].name = (dir0 == 0 ? name0 : concat (dir0, "/", name0));
  327. ! #endif
  328. ! #ifdef AMIGA
  329. !   if (dir1 == 0L) inf[1].name = name1;
  330. !   else {
  331. !     if (*dir1 == '\0') inf[1].name = strdup(name1);
  332. !     else {
  333. !       tmp_name = concat(dir1, "/", name1);
  334. !       inf[1].name = fixupname(tmp_name);
  335. !       free(tmp_name);
  336. !     };
  337. !   };
  338. !   /* fprintf(stderr,"509: fixupname=%s\n",inf[1].name); */
  339. !   fflush(stderr);
  340. ! #else
  341. !   inf[1].name = ((dir1 == 0) ? name1 : concat (dir1, "/", name1));
  342. ! #endif
  343.   
  344.     /* Stat the files.  Record whether they are directories.
  345.        Record in stat_result whether stat fails.  */
  346. ***************
  347. *** 588,596 ****
  348.         int dir_arg = (inf[0].dir_p ? 0 : 1);
  349.         int fnm_arg = (inf[0].dir_p ? 1 : 0);
  350.         char *p = rindex (inf[fnm_arg].name, '/');
  351.         char *filename = concat (inf[dir_arg].name,  "/",
  352.                      (p ? p+1 : inf[fnm_arg].name));
  353.         if (inf[fnm_arg].name == Standard_Input)
  354.       fatal ("can't compare - to a directory");
  355.   
  356. --- 625,643 ----
  357.         int dir_arg = (inf[0].dir_p ? 0 : 1);
  358.         int fnm_arg = (inf[0].dir_p ? 1 : 0);
  359.         char *p = rindex (inf[fnm_arg].name, '/');
  360. + #ifdef AMIGA
  361. +       char *filename;
  362. +       if (strcmp(inf[dir_arg].name,"") == 0)
  363. +         filename = strdup((p ? p+1 : inf[fnm_arg].name));
  364. +       else  {
  365. +         filename = concat (inf[dir_arg].name,  "/", (p ? p+1 : inf[fnm_arg].name));
  366. +         filename = fixupname(filename);
  367. +       };
  368. +       /* fprintf(stderr,"633: fixupname=%s\n",filename); */
  369. + #else
  370.         char *filename = concat (inf[dir_arg].name,  "/",
  371.                      (p ? p+1 : inf[fnm_arg].name));
  372. ! #endif
  373.         if (inf[fnm_arg].name == Standard_Input)
  374.       fatal ("can't compare - to a directory");
  375.   
  376. ***************
  377. *** 605,616 ****
  378.       {
  379.         /* JF: patch from the net to check and make sure we can really free
  380.            this.  If it's from argv[], freeing it is a *really* bad idea */
  381.         if (0 != (dir_arg ? dir1 : dir0))
  382.           free (inf[dir_arg].name);
  383.         inf[dir_arg].name = filename;
  384.         if (fstat (inf[dir_arg].desc, &inf[dir_arg].stat) < 0)
  385.           pfatal_with_name (inf[dir_arg].name);
  386.         inf[dir_arg].dir_p
  387.           = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFMT));
  388.         if (inf[dir_arg].dir_p)
  389. --- 652,669 ----
  390.       {
  391.         /* JF: patch from the net to check and make sure we can really free
  392.            this.  If it's from argv[], freeing it is a *really* bad idea */
  393. + #ifndef AMIGA
  394.         if (0 != (dir_arg ? dir1 : dir0))
  395.           free (inf[dir_arg].name);
  396. + #endif
  397.         inf[dir_arg].name = filename;
  398. + #ifdef AMIGA
  399. +       if (stat (inf[dir_arg].name, &inf[dir_arg].stat) < 0)
  400. +         pfatal_with_name (inf[dir_arg].name);
  401. + #else
  402.         if (fstat (inf[dir_arg].desc, &inf[dir_arg].stat) < 0)
  403.           pfatal_with_name (inf[dir_arg].name);
  404. ! #endif
  405.         inf[dir_arg].dir_p
  406.           = (S_IFDIR == (inf[dir_arg].stat.st_mode & S_IFMT));
  407.         if (inf[dir_arg].dir_p)
  408. Files /GNU/context.c and context.c are identical
  409. Files /GNU/analyze.c and analyze.c are identical
  410. Files /GNU/alloca.c and alloca.c are identical
  411.